package ch.unisi.inf.java.project.riskbami.model;



/**
 * The test class PlayerTest.
 *
 * @author minellir@lu.unisi.ch
 * @author babazadm@lu.unisi.ch
 */
public final class PlayerTest extends junit.framework.TestCase
{
    public final void testConstructor()
    {   
        final Player player1 = new Human("name", null);
        assertNull(player1.getColor());
        assertEquals("name", player1.getName());
    }

    public final void testOwnedCountries()
    {
        final Player player1 = new Human("Niubbo", null);
        final Country italia = new Country("Italy");
        player1.addOwnedCountry(italia);
        java.util.ArrayList ownedCountriesArray = player1.getOwnedCountries();
        java.util.ArrayList<Country> testArray = new java.util.ArrayList<Country>();
        testArray.add(italia);
        assertEquals(testArray, ownedCountriesArray);
    }

    public final void testFortify()
    {
        final Player player1 = new Human("niubbo", null);
        final Country country1 = new Country("Swiss");
        final Country country2 = new Country("Italy");
        player1.addOwnedCountry(country1);
        player1.addOwnedCountry(country2);
        country1.addArmies(10);
        country2.addArmies(10);
        player1.fortify(country1, country2, 5);
        assertEquals(5, country1.getNumberOfArmies());
        assertEquals(15, country2.getNumberOfArmies());
    }

    public final void testGetPerTurnArmies()
    {
        final Player player1 = new Human("niubbo", null);
        final Country country1 = new Country("c1");
        final Country country2 = new Country("c2");
        final Country country3 = new Country("c3");
        final Country country4 = new Country("c4");
        final Country country5 = new Country("c5");
        final Country country6 = new Country("c6");
        player1.addOwnedCountry(country1);
        player1.addOwnedCountry(country2);
        player1.addOwnedCountry(country3);
        player1.addOwnedCountry(country4);
        player1.addOwnedCountry(country5);
        player1.addOwnedCountry(country6);
        player1.computePerTurnArmies();
        assertEquals(2, player1.getPerTurnArmies());
    }
}





